package com.esri.core.renderer;

import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import com.esri.core.symbol.Symbol;
import com.esri.core.symbol.SymbolHelper;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class ClassBreak {
    double a;
    double b;
    String c;
    String d;
    Symbol e;

    public ClassBreak() {
    }

    public ClassBreak(JsonNode jsonNode) throws Exception {
        if (jsonNode == null) {
            return;
        }
        JsonNode jsonNode2 = jsonNode.get("symbol");
        if (jsonNode2 != null) {
            this.e = SymbolHelper.parseSymbol(jsonNode2);
        }
        JsonNode jsonNode3 = jsonNode.get("label");
        if (jsonNode3 != null) {
            this.c = jsonNode3.getTextValue();
        }
        JsonNode jsonNode4 = jsonNode.get("description");
        if (jsonNode4 != null) {
            this.d = jsonNode4.getTextValue();
        }
        JsonNode jsonNode5 = jsonNode.get("classMaxValue");
        if (jsonNode5 != null) {
            this.b = jsonNode5.getDoubleValue();
        }
    }

    public double getClassMinValue() {
        return this.a;
    }

    public void setClassMinValue(double d) {
        this.a = d;
    }

    public double getClassMaxValue() {
        return this.b;
    }

    public void setClassMaxValue(double d) {
        this.b = d;
    }

    public String getLabel() {
        return this.c;
    }

    public void setLabel(String str) {
        this.c = str;
    }

    public String getDescription() {
        return this.d;
    }

    public void setDescription(String str) {
        this.d = str;
    }

    public Symbol getSymbol() {
        return this.e;
    }

    public void setSymbol(Symbol symbol) {
        this.e = symbol;
    }

    public static ClassBreak fromJson(JsonParser jsonParser) throws Exception {
        ClassBreak classBreak = new ClassBreak();
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("Unable to parse the Response for this UniqueValue.");
        }
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("classMinValue".equals(currentName)) {
                classBreak.a = jsonParser.getDoubleValue();
            } else if ("classMaxValue".equals(currentName)) {
                classBreak.b = jsonParser.getDoubleValue();
            } else if ("label".equals(currentName)) {
                classBreak.c = jsonParser.getText();
            } else if ("description".equals(currentName)) {
                classBreak.d = jsonParser.getText();
            } else if ("symbol".equals(currentName)) {
                classBreak.e = SymbolHelper.createSymbol(jsonParser);
            } else {
                jsonParser.skipChildren();
            }
        }
        return classBreak;
    }

    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartObject();
        a.writeStringField("label", this.c);
        a.writeStringField("description", this.d);
        a.writeNumberField("classMaxValue", this.b);
        if (this.e != null) {
            a.writeFieldName("symbol");
            a.writeRaw(':');
            a.writeRaw(this.e.toJson());
        }
        a.writeEndObject();
        a.close();
        return stringWriter.toString();
    }
}
